-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ConfigurationManager when BaseDirectory starts with \\?" #58627
Conversation
Tagging subscribers to this area: @safern Issue DetailsFixes: #56897 Currently WinForms designed launches the process such that it prepends I did not find any scenarios where using Uri would have any benefits and Path.Combine seem to be fine to use. Tested by creating a sample app which starts itself and prepends Also tested by checking if
|
Here's the original commit that added the call to Also, side question: is |
It was necessary in .NET Framework because the code started with
Yes.
Maybe. Uri parsing is very complex with many legacy quirks and any fixes in it are risky and involved. Not a good candidate for .NET 6 fix. Also, we may want to strip It may be a good idea to create a follow up issues for both of these. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given @jkotas's answers above, this LGTM.
It may be a good idea to create a follow up issues for both of these.
+1
Fixes: #56897
Currently WinForms designer launches the process such that it prepends
\\?\
because temporary directory it uses might end up with long path issues. This fixes the issue.I did not find any scenarios where using Uri would have any benefits and Path.Combine seem to be fine to use.
Tested by creating a sample app which starts itself and prepends
\\?\
to its own path and then executingConfigurationManager.AppSettings.Get("foo")
- in the success path it should return null, currently it throws an exception (only when process is launched with\\?\
prepended). Additionally tested the same when addedApp.config
file withfoo
setting and made sure it read the value correctly.Also tested by checking if
Path.Combine
correctly works for various paths (UNC, regular file path,\\?\
prepended path).